﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
    <title>Door: DoorTester.cpp Source File</title>
    <link href="/Content/Help.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/tabs.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div id="header">
        <img id="logo" alt="StateForge" src="/Content/Images/StateForgeLogo.png" />
        <div id="title">
            <h1>
                Examples using state machines generated by StateBuilderCpp
            </h1>
            <h3>
                Door: DoorTester.cpp Source File
            </h3>
        </div>
        <div id="menucontainer">
            <ul id="menu">
                <li><a href="/">Home</a></li>
                <li><a href="/Home/Download">Downloads</a></li>
                <li><a href="/Help/state-machine-tools.aspx">Help</a></li>
                <li><a href="/Home/Faq">F.A.Q</a></li>
                <li><a href="/Home/About">Contact us</a></li>
            </ul>
        </div>
    </div>
<!-- Generated by Doxygen 1.7.4 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">DoorTester.cpp</div>  </div>
</div>
<div class="contents">
<a href="_door_tester_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00002"></a>00002 <span class="preprocessor">#include &lt;SmBoostObserver.h&gt;</span>
<a name="l00003"></a>00003 <span class="preprocessor">#include &quot;<a class="code" href="_door_tester_8h.html">DoorTester.h</a>&quot;</span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &quot;DoorTesterFsm.h&quot;</span>
<a name="l00005"></a>00005 
<a name="l00006"></a>00006 <span class="keyword">using namespace </span>std;
<a name="l00007"></a>00007 
<a name="l00008"></a><a class="code" href="class_door_tester.html#a80abe00f8be6ba27f59e418336c8c162">00008</a> <a class="code" href="class_door_tester.html#a80abe00f8be6ba27f59e418336c8c162">DoorTester::DoorTester</a>(<a class="code" href="class_door.html">Door</a> &amp;door, boost::asio::io_service &amp;io_service) : m_door(door)
<a name="l00009"></a>00009 {
<a name="l00010"></a>00010     <a class="code" href="class_door_tester.html#a8581d2694ec8a1d04323bc60930cb103">m_pContext</a> = <span class="keyword">new</span> DoorTesterContext(*<span class="keyword">this</span>, io_service);
<a name="l00011"></a>00011     <a class="code" href="class_door_tester.html#a8581d2694ec8a1d04323bc60930cb103">m_pContext</a>-&gt;SetObserver(SmBoostObserver::GetInstance());
<a name="l00012"></a>00012     <a class="code" href="class_door_tester.html#a8581d2694ec8a1d04323bc60930cb103">m_pContext</a>-&gt;EnterInitialState();
<a name="l00013"></a>00013 }
<a name="l00014"></a>00014 
<a name="l00015"></a><a class="code" href="class_door_tester.html#a5aca0f4ab97924adcbfe0a83853967bb">00015</a> <a class="code" href="class_door_tester.html#a5aca0f4ab97924adcbfe0a83853967bb">DoorTester::~DoorTester</a>() 
<a name="l00016"></a>00016 {
<a name="l00017"></a>00017     <span class="keyword">delete</span> <a class="code" href="class_door_tester.html#a8581d2694ec8a1d04323bc60930cb103">m_pContext</a>;
<a name="l00018"></a>00018 }
<a name="l00019"></a>00019 
<a name="l00020"></a><a class="code" href="class_door_tester.html#af78eddb92dd782a6c02c384b0b0339b5">00020</a> DoorTesterContext&amp; <a class="code" href="class_door_tester.html#af78eddb92dd782a6c02c384b0b0339b5">DoorTester::GetContext</a>()
<a name="l00021"></a>00021 {
<a name="l00022"></a>00022     <span class="keywordflow">if</span>(<a class="code" href="class_door_tester.html#a8581d2694ec8a1d04323bc60930cb103">m_pContext</a> != NULL){
<a name="l00023"></a>00023         <span class="keywordflow">return</span> *<a class="code" href="class_door_tester.html#a8581d2694ec8a1d04323bc60930cb103">m_pContext</a>;
<a name="l00024"></a>00024     } <span class="keywordflow">else</span> {
<a name="l00025"></a>00025         <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;context is not set&quot;</span>);
<a name="l00026"></a>00026     }
<a name="l00027"></a>00027 }
<a name="l00028"></a>00028 
<a name="l00029"></a><a class="code" href="class_door_tester.html#acb66e5a64a0a6583d817bbb88c12c71c">00029</a> <span class="keywordtype">void</span> <a class="code" href="class_door_tester.html#acb66e5a64a0a6583d817bbb88c12c71c">DoorTester::EvStartTest</a>()
<a name="l00030"></a>00030 {
<a name="l00031"></a>00031     <a class="code" href="class_door_tester.html#af78eddb92dd782a6c02c384b0b0339b5">GetContext</a>().EvStartTest();
<a name="l00032"></a>00032 }
</pre></div></div>
</div>
﻿<div id="footer">
    <hr />
    <p>
        Copyright &copy; 2011 StateForge.</p>
    <hr />
</div>
</body> </html> 
